<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="com.lavegue.model.Area" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>名录列表搜索</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<script type='text/javascript' src='dwr/interface/userdwr.js'></script>
     <script type='text/javascript' src='dwr/interface/areadwr.js'></script>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type='text/javascript' src='js/jquery.validate.min.js'></script>
 	<script type='text/javascript' src='js/common.js'></script>
	
	 <script type='text/javascript' src='<%=basePath %>/dwr/engine.js'></script>
	 <script type='text/javascript' src='<%=basePath %>/dwr/util.js'></script>
	
	<script type="text/javascript" src="js/PCASClass.js"></script>
	<script language="javascript" type="text/javascript" src="<%=basePath %>/date/WdatePicker.js"></script>
	<link type="text/css"  href="images/css.css"  rel="stylesheet" />
	<link href="<%=basePath%>/backStageManage/bs.css"  rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.STYLE18 {
	color: #F57E00;
	font-size: 14px;
}
.STYLE20 {color: #F57E00}
-->
</style>

<script type="text/javascript">

//省份按钮事件
function changeProvinceHandler() {
	//获取省份下拉框的值
	var province = $("#province").val();
//	alert("province=="+province);
	//如果选择了"请选择这个项" (0表示选择了这个项)
	if (province == 0) {
		//删除市和区域下拉的全部选项
		DWRUtil.removeAllOptions("city");
		DWRUtil.addOptions("city", [{"id":0,"name":"请选择..." }], "id", "name");
		DWRUtil.removeAllOptions("area");
		DWRUtil.addOptions("area", [{"id":0,"name":"请选择..." }], "id", "name");
		return;
	} 		
	//删除市下拉的全部选项
	DWRUtil.removeAllOptions("city");
	//根据所选择的省从后台获取相关的市
	areadwr.findAreaByParendIdAndlvType(province, <%= Area.AreaType.CITY%>, function(data){
	DWRUtil.addOptions("city", [{"id":0,"name":"请选择..." }], "id", "name");
	DWRUtil.addOptions("city", data, "id", "name");   //把data数据填充到城市下拉框
	DWRUtil.removeAllOptions("area");   //清除区域的初始值
	DWRUtil.addOptions("area", [{"id":0,"name":"请选择" }], "id", "name");
	});
	
}

//城市按钮事件
function changeCityHandler() {
	var city = $("#city").val();
	//如果选择了"请选择这个项"
	if (city == 0) {
		//删除区下拉的全部选项
		DWRUtil.removeAllOptions("area");
		DWRUtil.addOptions("area", [{"id":0,"name":"请选择..." }], "id", "name");
		return;
	} 
				
	//删除区域下拉的全部选项
	DWRUtil.removeAllOptions("area");
	//根据所选择的市从后台获取相关的区
	areadwr.findAreaByParendIdAndlvType(city, <%= Area.AreaType.AREA%>, function(data) {
	DWRUtil.addOptions("area", [{"id":0,"name":"请选择..." }], "id", "name");
	DWRUtil.addOptions("area", data, "id", "name"); //把data数据填充到区域下拉框
	});
}

function serachInfoSubmit(){
	if(!checkVal()){
		return false;
	}else{
		document.beadrollFrm.submit();
	}
}

//转至多少页码
function changePage(listId,sf_id,cs_id)
{
	 //	alert(listId+",sf_id="+sf_id+",cs_id="+cs_id);
	document.location.href="dmAction!proceedBeadrollSearchList.action?pageNo="+listId+"&sf_id="+sf_id+"&cs_id="+cs_id;
} 

function checkVal(){
	var province=$.trim($("#province").val());  //省份
	var city=$.trim($("#city").val());  //市区
	if(province == 0 || city ==0){
		$("#areaSpan").html("请选择所在地区");
		return false;
	}else{
		$("#areaSpan").html("");
		
	}
	return true;
}

</script>

</head>
  
<body>
   
   <table width="789" border="0" cellpadding="0" cellspacing="0" bgcolor="#F1F1F1">
  <tr>
    <td width="789" height="39" align="left" valign="middle">
    	<span class="STYLE1">&nbsp;<a href="javascript:void(parent.window.location.href='loginAction!login.action')" class="STYLE1">我的易彩通</a> &gt; 我的账户 &gt; 名录搜索</span>
    </td>
  </tr>
  <tr>
    <td align="center" valign="top" bgcolor="#FFFFFF" style="border:1px solid #C5C5C5; padding:1px ;">
    <table width="100%" height="32" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="1%" height="32" background="images/sp_bg.jpg">&nbsp;</td>
        <td width="3%" align="center" background="images/sp_bg.jpg" style="border-bottom:1px solid #C5C5C5;"><img src="images/dian.jpg" width="10" height="16" /></td>
        <td width="95%" align="left" background="images/sp_bg.jpg" style="border-bottom:1px solid #C5C5C5;"><span class="STYLE3">名录搜索</span></td>
        <td width="1%" background="images/sp_bg.jpg">&nbsp;</td>
      </tr>
    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="23">&nbsp;</td>
        </tr>
      </table>
      
      <table width="775" border="0" cellpadding="0" cellspacing="0">
  <s:form name="beadrollFrm" id="beadrollFrm" action="dmAction!proceedBeadrollSearchList.action" method="post">
        <tr>
          <td width="99" height="38" align="right">所在地区：</td>
          <td width="676" align="left" valign="middle">
         	<s:select name="beadroll.provinceArea.id" onchange="changeProvinceHandler();" id="province" value="sf_id" list="provinces" headerKey="0" style="width:20%;" headerValue="请选择..." listValue="name" listKey="id" > </s:select>
			省
			<s:select id="city" list="cityList" name="beadroll.cityArea.id" value="cs_id" style="width:15%;" headerKey="0" headerValue="请选择..." listKey="id" listValue="name"></s:select>
			市
			<%--<s:select list="#{0:'请选择...'}" id="area" name="area" style="width:20%;" ></s:select>
			区 --%>
			<span class="STYLE6">*</span>
            <span style="color:red"  id="areaSpan"></span>
          </td>
        </tr>
        <tr>
          <td width="99" height="38" align="right">&nbsp;</td>
          <td width="676" align="left" valign="middle">
          		<img src="images/ss3.jpg" onClick="javascript:serachInfoSubmit();" style="cursor:hand" width="92" height="24">
          </td>
        </tr>
  </s:form>
        <tr>
          <td height="147" colspan="2" align="center" valign="top">
          <table width="766" border="0" cellpadding="0" cellspacing="0">
       <%--begin 列表的头 --%>
        <tr>
		          <td width="240" align="center" background="images/lm1_bg.jpg">公司名称</td>
		          <td width="10" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="115" align="center" background="images/lm1_bg.jpg">联系人</td>
		          <td width="10" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="90" align="center" background="images/lm1_bg.jpg">职位</td>
		          <td width="10" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="90" align="center" background="images/lm1_bg.jpg">移动电话</td>
		          <td width="10" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" width="10" height="25" /></td>
		          <td width="100" align="center" background="images/lm1_bg.jpg">所在地区</td>
		          <td width="11" align="center" background="images/lm1_bg.jpg"><img src="images/line2.jpg" alt="" width="10" height="25" /></td>
		          <td width="70" align="center" background="images/lm1_bg.jpg">操作</td>
		</tr>
		<%--end 列表的头 --%>
		
		<%--begin 列表信息--%>
       <s:iterator value="beadrollPage.data" id="beadrollObj" status="st"> 
		        <tr <s:if test="#st.odd">style="background-color:#F7F7F7"</s:if>>
		          <td height="30" align="center"><s:property value="beadrollPage.data[#st.index].company"/></td>
		          <td>&nbsp;</td>
		          <td align="center"><s:property value="beadrollPage.data[#st.index].linkman"/></td>
		          <td>&nbsp;</td>
		          <td align="center"><s:property value="beadrollPage.data[#st.index].position"/></td>
		          <td align="center">&nbsp;</td>
		          <td align="center"><s:property value="beadrollPage.data[#st.index].mobile"/></td>
		          <td align="center">&nbsp;</td>
		          <td align="center">
		          	<s:property value="beadrollPage.data[#st.index].provinceArea.name"/>&nbsp;&nbsp;
		          	<s:property value="beadrollPage.data[#st.index].cityArea.name"/>
		          </td>
		          <td align="center">&nbsp;</td>
		          <td align="center" class="lbsx">
			          <table width="90" height="28" border="0" cellpadding="0" cellspacing="0">
			            <tr align="center">
			              <td width="40" align="right"><img src="images/ck11.jpg" width="15" height="16">&nbsp;&nbsp;</td>
			              <td width="50" align="left">
				              <a href="dmAction!toLookDetailBeadroll.action?bid=${beadrollObj.id}&sf_id=${sf_id}&cs_id=${cs_id}">查看</a>
			              </td>
			            </tr>
			          </table>
		          </td>
		        </tr>
		     </s:iterator>
        <%--end 列表信息--%>

     	<tr align="right">
          <td height="29" colspan="11" align="right" background="images/lm1_bg.jpg" >
    <%-- 分页 --%>         
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="right">
   <s:if test="beadrollPage.data != null">
        <s:if test="beadrollPage.hasOnePage==false">
			<s:form action="" method="post" id="pageFrm" name="pageFrm">
            <tr align="right">
              <td align="right">
              
              <s:if test="beadrollPage.pageNo==1">首页</s:if>
			  <s:else>
				  <a href="dmAction!proceedBeadrollSearchList.action?pageNo=1&sf_id=${sf_id}&cs_id=${cs_id}" class="STYLE5">首页</a> 
			  </s:else>&nbsp;
              
              <s:if test="beadrollPage.hasPrePage==false">上一页</s:if>
			  <s:else> 
				 <a href="dmAction!proceedBeadrollSearchList.action?pageNo=<s:property value="beadrollPage.pageNo-1"/>&sf_id=${sf_id}&cs_id=${cs_id}" class="STYLE5">上一页</a>
			  </s:else>&nbsp;

              <s:if test="beadrollPage.hasNextPage==false">下一页</s:if>
		      <s:else>
				 <a href="dmAction!proceedBeadrollSearchList.action?pageNo=<s:property value="beadrollPage.pageNo+1"/>&sf_id=${sf_id}&cs_id=${cs_id}" class="STYLE5">下一页</a>
			  </s:else>&nbsp;
              
              <s:if test="beadrollPage.pageNo==beadrollPage.totalPage">末页</s:if>
			  <s:else>
			    <a href="dmAction!proceedBeadrollSearchList.action?pageNo=<s:property value="beadrollPage.totalPage"/>&sf_id=${sf_id}&cs_id=${cs_id}" class="STYLE5"> 末页 </a>
			  </s:else>
              
              &nbsp;&nbsp;第${beadrollPage.pageNo}页&nbsp;|&nbsp;
                                    共<s:property value="beadrollPage.totalPage"/>页&nbsp;|&nbsp;
                                    共${beadrollPage.totalRecord}条&nbsp;&nbsp;转至&nbsp;
    			<select onchange="changePage(this.value,${sf_id},${cs_id})" id="pageNo" name="pageNo">
    					<s:iterator var="a"  begin="1" end="beadrollPage.totalPage" status="st">
    						<option value="<s:property value="#a"/>"><s:property value="#a"/></option>
    					</s:iterator>
    			</select>&nbsp;&nbsp;
                
              </td>
            </tr>
            </s:form>
         </s:if>
         <s:else>
            	<tr align="right">
	              <td height="29" align="right" background="images/lm1_bg.jpg" >
				 	首页&nbsp;上一页&nbsp;下一页&nbsp;末页           
	              	&nbsp;&nbsp;第1页&nbsp;|&nbsp;共1页&nbsp;|&nbsp;&nbsp;
	    		  </td>
	            </tr>
         </s:else>
            
   </s:if>
   <s:else>
          <tr>
		      <td height="29" align="center" background="images/lm1_bg.jpg" >
				<p style="color: blue;font-size: 12px;text-align: center;"></p>
		      </td>
		  </tr>	 
  </s:else>	 
  <%-- 分页结束 --%>
	          </table>          
   
          </td>
        </tr>
        <tr>
          <td height="25" colspan="11" align="right" class="STYLE15">&nbsp;</td>
        </tr>
      </table>
          </td>
        </tr>
    </table></td>
  </tr>
</table>
  <SCRIPT type="text/javascript">
  var pageno = '<%= request.getParameter("pageNo")%>';
  $("#pageNo").val(pageno);
  </SCRIPT>
</body>
</html>
